package com.shanzmoo.db.product.entity.vo;

import com.shanzmoo.db.product.entity.ProductCategoryEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@ApiModel("首页分类对象")
public class IndexCategoryVO implements Serializable {
    private static final long serialVersionUID = 1758L;

    @ApiModelProperty("分类id")
    private Integer categoryId;

    @ApiModelProperty("分类名称")
    private String name;

    @ApiModelProperty("一级分类图片")
    private String pictureUrl;

    public static IndexCategoryVO create(ProductCategoryEntity categoryEntity) {
        return IndexCategoryVO.builder()
                .categoryId(categoryEntity.getId())
                .name(categoryEntity.getName())
                .pictureUrl(categoryEntity.getPictureUrl())
                .build();
    }
}
